<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简易计算器</title>
    <script>
        function fn(operate) {
            let num1 = document.getElementById("num1").value;
            let num2 = document.getElementById("num2").value;
            if (operate == "+") {
                document.getElementById("result").innerHTML = parseFloat(num1) + parseFloat(num2);
            } else if (operate == "-") {
                document.getElementById("result").innerHTML = parseFloat(num1) - parseFloat(num2);
            } else if (operate == "*") {
                document.getElementById("result").innerHTML = parseFloat(num1) * parseFloat(num2);
            } else if (operate == "/") {
                document.getElementById("result").innerHTML = parseFloat(num1) / parseFloat(num2);
            }
        }
    </script>
</head>
<body>
<table>
    <tr>
        <td>第一个数:</td>
        <td><input type="text" id="num1"></td>
    </tr>
    <tr>
        <td>第二个数:</td>
        <td><input type="text" id="num2"></td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <input type="button" value="&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;" onclick="fn('+')">
            <input type="button" value="&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;" onclick="fn('-')">
            <input type="button" value="&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;" onclick="fn('*')">
            <input type="button" value="&nbsp;&nbsp;&nbsp;÷&nbsp;&nbsp;&nbsp;" onclick="fn('/')">
        </td>
    </tr>
    <tr>
        <td>计算结果</td>
        <td>
            <span id="result"></span>
        </td>
    </tr>
</table>
</body>
</html>